home *** CD-ROM | disk | FTP | other *** search
/ El Mac 9 / El Mac 9.iso / Shareware / Applications / MathPad 2.4 / XFuns / XFun kit / util src / callbackg.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-01  |  3.3 KB  |  178 lines  |  [TEXT/CWIE]

  1. /*
  2.    Define callback routines.
  3.    This file assumes a global ptr "callback" has been set rather
  4.    than passing it as a parameter
  5.  
  6.    The compiler must be set so that type "double" is a SANE 80-bit.
  7.  
  8. */
  9.  
  10. #include "xfuns.h"
  11. #include "callbackg.h"
  12.  
  13. void AddXfun(char *name,char *parms,funptr entry,funptr predef)
  14. {
  15.    (*callback)((long)ADDXFUN,name,parms,entry,predef);
  16. }
  17.  
  18. void AddFunDim(char *name,long lim)
  19. {
  20.    (*callback)((long)ADDFUNDIM,name,lim);
  21. }
  22.  
  23. void ErrMsg(char *fmt,char *str)
  24. {
  25.    (*callback)((long)ERRMSG,fmt,str);
  26. }
  27.  
  28. void FreeExpr(EXPR xpr)
  29. {
  30.    (*callback)((long)FREEXPR,xpr);
  31. }
  32.  
  33. short EvalExpr(EXPR xpr,double *num)
  34. {
  35.    return((*callback)((long)EVALEXPR,xpr,num));
  36. }
  37.  
  38. short GetExprMatrix(EXPR xpr,double **mat,long *rows,long *cols)
  39. {
  40.    return((*callback)((long)GETEXPRMATRIX,xpr,mat,rows,cols));
  41. }
  42.  
  43. short GetParmVal(long n,double *num)
  44. {
  45.    return((*callback)((long)GETPARMVAL,(long) n,num));
  46. }
  47.  
  48. void MakeParmExpr(long n,EXPR *xpr)
  49. {
  50.    (*callback)((long)MAKEPARMEXPR,(long) n,xpr);
  51. }
  52.  
  53. short ProbeExpr(EXPR xpr,double *num,short *isarray,long *count)
  54. {
  55.    return((*callback)((long)PROBEXPR,xpr,num,isarray,count));
  56. }
  57.  
  58. short GetParmName(long n,char **name)
  59. {
  60.    return((*callback)((long)GETPARMNAME,(long) n,name));
  61. }
  62.  
  63. void AddIndex(EXPR *xpr,double **iptr)
  64. {
  65.    (*callback)((long)ADDINDEX,xpr,iptr);
  66. }
  67.  
  68. void RemoveIndex(EXPR *xpr)
  69. {
  70.    (*callback)((long)REMOVEINDEX,xpr);
  71. }
  72.  
  73. short GetVarVal(char *name,double *num)
  74. {
  75.    return((*callback)((long)GETVARVAL,name,num));
  76. }
  77.  
  78. void MakeVarExpr(char *name,EXPR *xpr)
  79. {
  80.    (*callback)((long)MAKEVAREXPR,name,xpr);
  81. }
  82.  
  83. short SetVarVal(char *name,double num)
  84. {
  85.    return((*callback)((long)SETVARVAL,name,&num));    /* callback parm must be ptr size */
  86. }
  87.  
  88. short SetVarMatrix(char *name,double *arr,long rows,long cols)
  89. {
  90.    return((*callback)((long)SETVARMATRIX,name,arr,rows,cols));
  91. }
  92.  
  93. void FoldVar(char *name,long lim)
  94. {
  95.    (*callback)((long)FOLDVAR,name,lim);
  96. }
  97.  
  98. short Stopped(void)
  99. {
  100.    return((*callback)((long)STOPPED));
  101. }
  102.  
  103. void SpinWatch(void)
  104. {
  105.    (*callback)((long)SPINWATCH);
  106. }
  107.  
  108. void SetPlotPICT(PicHandle thePic )
  109. {
  110.    (*callback)((long)SETPLOTPICT,thePic);
  111. }
  112.  
  113. void SizePlotPICT(double left,double bot,double width,double ht)
  114. {
  115.    (*callback)((long)SIZEPLOTPICT,&left,&bot,&width,&ht);
  116. }
  117.  
  118. void GetVarString(char *name,char **str )
  119. {
  120.    (*callback)((long)GETVARSTRING,name,str);
  121. }
  122.  
  123. void SetCursorRegion(Cursor *curs,RgnHandle inside)
  124. {
  125.    (*callback)((long)SETCURSORREGION,curs,inside);
  126. }
  127.  
  128. void InstallEventHandler(funptr handler)
  129. {
  130.    (*callback)((long)INSTALLEVENTHANDLER,handler);
  131. }
  132.  
  133. short GetDocInfo(long *docref,FSSpec *fspec,WindowPtr *plotwindow)
  134. {
  135.    (*callback)((long)GETDOCINFO,docref,fspec,plotwindow);
  136. }
  137.  
  138. void GetAngleUnits(double *unit)
  139. {
  140.    (*callback)((long)GETANGLEUNITS,unit);
  141. }
  142.  
  143. void GetAxisRect(Rect *axisrect)
  144. {
  145.    (*callback)((long)GETAXISRECT,axisrect);
  146. }
  147.  
  148. short Sprintf(char *buf,char *fmt,double num)
  149. {
  150.    (*callback)((long)SPRINTF,buf,fmt,&num);
  151. }
  152.  
  153. void ReturnVoid(void)
  154. {
  155.    (*callback)((long)RETURNVOID);
  156. }
  157.  
  158. void DoMenuItem(long selector)
  159. {
  160.    (*callback)((long)DOMENUITEM,selector);
  161. }
  162.  
  163. void GetAxisLimits(double *limits)
  164. {
  165.    (*callback)((long)GETAXISLIMITS,limits);
  166. }
  167.  
  168. void GetPlotInfo(double *info)
  169. {
  170.    (*callback)((long)GETPLOTINFO,info);
  171. }
  172.  
  173. void MapData(double x,double y,short *xpixel,short *ypixel)
  174. {
  175.    (*callback)((long)MAPDATA,&x,&y,xpixel,ypixel);
  176. }
  177.  
  178.